package io.github.siltal.examsystembackend.dto;

import io.github.siltal.examsystembackend.entity.ExamHistory;

import java.time.Instant;
import java.util.List;

public record ExamHistoryItem(
        Long id,                  // 题目类型: 0/1=单选, 2=多选
        Instant date,
        Long score,
        List<ExamHistoryQO> examHistoryQOs
) {
    public static ExamHistoryItem from(ExamHistory examHistory) {
        return new ExamHistoryItem(examHistory.getId(), examHistory.getCreatedAt(), examHistory.getScore(), examHistory.getQuestions());
    }
}